<template>
	<view class="sub-appeal-content">
		<view class="home-top">
			<view class="home-title">回填订单号</view>
			<image src="../../../static/common/sub-back-icon.png" class="sub-back-icon" @tap="backpage"></image>
			<image src="../../../static/common/sbu-home-top-icon.png" class="sub-home-top-icon" @tap="contactKF"></image>
		</view>
		
		<view class="make-order-tip">
			<view>多次拍错实拍金额，会被永久限制参与！</view>
		</view>
		<!-- 回单信息 -->
		<view class="huidan-info">
			<view class="title-tit">1. 复制商品订单号</view>
			<view class="verification">
				<view class="order-number">{{pasteText}}</view>
				<view class="paste" @tap="yanzheng">一键粘贴</view>
			</view>
			<view class="title-tit" style="margin-top: 50upx;">2. 核实金额</view>
			<view class="verification">
				<input class="fill-input" type="digit" placeholder="请填写此订单实付金额,如(270.00)" v-model="orderMoney">
			</view>
			<!-- <view class="title-tit" style="margin-top: 50upx;">3. 收货地址</view>
			<view class="address">
				<view class="add-user">
					<view class="user-info">
						<view class="user-name">{{CJFAddress.receiver}}</view>
						<view class="phone">{{CJFAddress.receiverPhone}}</view>
					</view>
					<view class="user-address">{{CJFAddress.sprovince}}{{CJFAddress.scity}}{{CJFAddress.sarea}}{{CJFAddress.address}}</view>
				</view>
				<view class="user-edit">
					<image src="../../../static/common/cash-icon2.png" class="edit-icon"></image>
					<navigator url="../sub-userInfo/sub-userInfo" hover-class="none">
						<view class="edit-text">编辑</view>
					</navigator>
					
				</view>
			</view> -->
			<button class="fill-submit" @tap="submit_Order">确认提交</button>
		</view>
		
		
	</view>
</template>

<script>
	export default{
		name:"subAppeal",
		data(){
			return{
				orderList:[],
				apptoken:"",
				pasteText:"",
				CJFAddress:"",
				orderMoney:"",
				customertaskId:""
			}
		},
		onLoad(options) {
			console.log(options)
			this.customertaskId = options.customertaskId;
			this.apptoken = uni.getStorageSync("apptoken");
			this.CJFAddress = uni.getStorageSync("CJFAddress");
			console.log(this.CJFAddress)
			//加载收货地址
			const _this = this;
			setTimeout(function(){
				_this.makeTip();
			},500)
		},
		methods:{
			makeTip(){
				uni.showModal({
					title:"温馨提示",
					content:this.$CommonJS.content,
					showCancel:false
				})
			},
			submit_Order(){
				//提交回单
				const _this = this;
				if(!this.pasteText){
					this.$CommonJS.showToast("请粘贴订单号");
					return;
				}
				if(!this.orderMoney){
					this.$CommonJS.showToast("请填写订单金额");
					return;
				}
				uni.request({
					url:this.$API.URL + this.$API.task_op,
					data:{
						customertaskId:this.customertaskId,
						orderId:this.pasteText,
						pay:this.orderMoney,
						apptoken:this.apptoken
					},
					success(res) {
						console.log(res);
						if(res.data.success){
							_this.$CommonJS.showToast("提交成功");
							setTimeout(function(){
								uni.navigateTo({
									url:'../../superBack/super-back?type=order'
								})
							},2000)
						}else{
							_this.$CommonJS.showToast(res.data.msg)
						}
					}
				})
			},
			yanzheng(){
				//复制订单号
				this.pasteText = "";
				const _this = this;
				uni.getClipboardData({
					success: function (res) {
						if(res.data == ""){
							uni.showModal({
								title:"温馨提示",
								content:"请复制商品订单号,再粘贴",
								showCancel:false,
							})
						}else if( isNaN(Number(res.data)) ){
							uni.showModal({
								title:"温馨提示",
								content:"订单号不正确",
								showCancel:false,
							})
						}
						else{
							_this.pasteText = res.data;
						}
						
					},
					fail() {
						uni.showModal({
							title:"温馨提示",
							content:"请复制商品订单号,再粘贴",
							showCancel:false,
						})
					}
				});
			},
			writeOrder(){
				//回单
				uni.showModal({
					title:"温馨提示",
					content:this.$CommonJS.content,
					success(res) {
						if(res.confirm){
							console.log(111)
						}
					}
				})
			},
			backpage(){
				this.$CommonJS.navigateBack();
			},
			contactKF(){
				this.$CommonJS.navigateTo('../../subBack/sub-kefu/sub-kefu')
			}
		}
	}
</script>

<style scoped>
	@import url("sub-fillorder.css");
</style>
